using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_gal_memoMap : EntityTypeConfiguration<SO_gal_memo>
    {
        public SO_gal_memoMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Document__, t.Closed });

            // Properties
            this.Property(t => t.Document__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Reference)
                .HasMaxLength(10);

            this.Property(t => t.Ticket_number)
                .HasMaxLength(10);

            this.Property(t => t.Credit_Party__)
                .HasMaxLength(6);

            this.Property(t => t.Debit_Party__)
                .HasMaxLength(6);

            this.Property(t => t.Credit_Acct)
                .HasMaxLength(40);

            this.Property(t => t.Debit_Acct)
                .HasMaxLength(40);

            this.Property(t => t.Debit_Party_Type)
                .HasMaxLength(4);

            this.Property(t => t.Credit_Party_Type)
                .HasMaxLength(4);

            this.Property(t => t.Description)
                .HasMaxLength(100);

            this.Property(t => t.Batch)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.Closed)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.voucher__)
                .HasMaxLength(8);

            this.Property(t => t.Debit_or_Credit)
                .HasMaxLength(2);

            // Table & Column Mappings
            this.ToTable("SO_gal_memo");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.Reference).HasColumnName("Reference");
            this.Property(t => t.Ticket_number).HasColumnName("Ticket_number");
            this.Property(t => t.Credit_Party__).HasColumnName("Credit_Party_#");
            this.Property(t => t.Debit_Party__).HasColumnName("Debit_Party_#");
            this.Property(t => t.Credit_Acct).HasColumnName("Credit_Acct");
            this.Property(t => t.Debit_Acct).HasColumnName("Debit_Acct");
            this.Property(t => t.Debit_Party_Type).HasColumnName("Debit_Party_Type");
            this.Property(t => t.Credit_Party_Type).HasColumnName("Credit_Party_Type");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.Closed).HasColumnName("Closed");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.voucher__).HasColumnName("voucher_#");
            this.Property(t => t.Debit_or_Credit).HasColumnName("Debit_or_Credit");
            this.Property(t => t.Date).HasColumnName("Date");
        }
    }
}
